﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using LocalOverride.Fiddler.Store;

namespace LocalOverride.Fiddler.UI
{
    public interface IMappingEditorView
    {
        event EventHandler<EventArgs> AddOverride;
        event EventHandler<EditOverrideEventArgs> EditOverride;
        event EventHandler<DeleteOverrideEventArgs> DeleteOverride;
        event EventHandler<EventArgs> CancelOverrideEdit;
        event EventHandler<EventArgs> SaveOverrideEdit;
        BindingList<MappingEntry> MappingList { set; }
        string EditUrl { get; set; }
        string EditLocalPath { get; set; }
        bool IsDirectory { get; set; }
        string EditExtensions { get; set; }
        bool DownloadLocalCopy { get; set; }
        string EditDefaultFileName { get; set; }
        void ShowOverrideEditor();
        void HideOverrideEditor();
        void SetErrors(IEnumerable<ErrorNotification> errorNotification);
        void ClearErrors();
    }

    public class DeleteOverrideEventArgs : EventArgs
    {
        public MappingEntry Mapping { get; private set; }
        public DeleteOverrideEventArgs(MappingEntry mapping)
        {
            Mapping = mapping;
        }
    }

    public class EditOverrideEventArgs : EventArgs
    {
        public MappingEntry Mapping { get; private set; }
        public EditOverrideEventArgs(MappingEntry mapping)
        {
            Mapping = mapping;
        }
    }
}